package com.googlecode.linkmein.domain;

public class Result {
    private ResultType type;
    private String message;

    public Result(ResultType type, String message) {
        this.type = type;
        this.message = message;
    }

    public boolean isSuccess() {
        return type.isSuccess() || type.isAlreadyHad();
    }

    public boolean isFailed() {
        return type.isFailed();
    }

    public String getMessage() {
        return message;
    }

    @Override
    public String toString() {
        return String.format("[status:] %s, [message:] %s\n", getStatus(), getMessage());
    }

    private String getStatus() {
        return type.toString();
    }
}
